import i18next from 'i18next';

let isSubApp = false;
export function modifyClientRenderOpts(memo) {
  return {
    ...memo,
    rootElement: isSubApp ? 'sub-root' : memo.rootElement,
  };
}

// export function patchRoutes({ routes }) {
//   console.log('~~~~~~~~~', routes);
//   routes.unshift({
//     path: '',
//     exact: true,
//     component: require('').default,
//   });
// }

export function render(oldRender) {
  // console.log('发请求了！！！');
  oldRender();
}

export function getInitialState() {
  i18next.init({
    lng: localStorage.getItem('language') || 'us',
    debug: true,
    resources: {
      us: {
        translation: require('@/locales/en-US.json'),
      },
      cn: {
        translation: require('@/locales/zh-CN.json'),
      },
    },
  });
  window.i18next = i18next;
}
